package week5;
import java.util.Scanner;
public class project3 {
    public static boolean isPalindrome(int number) {
        if (number < 0) {
            return false;
        }
        int originalNumber = number;
        int reversedNumber = 0;
        while (number != 0) {
            int digit = number % 10;
            reversedNumber = reversedNumber * 10 + digit;
            number /= 10;
        }
        return originalNumber == reversedNumber;
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        System.out.print("请输入一个整数：");
        int num = scanner.nextInt();
        if (isPalindrome(num)) {
            System.out.println(num + " 是回文数");
        } else {
            System.out.println(num + " 不是回文数");
        }
        scanner.close();
    }
}
